package com.example.business.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.example.business.entity.SysImg;
import com.example.business.mapper.SysImgMapper;
import com.example.business.service.SysImgService;
import org.springframework.cache.annotation.*;
import java.io.Serializable;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.cache.annotation.CacheConfig;

/**
 * <p>
 * 视频封面表 服务实现类
 * </p>
 *
 * @author xiong
 * @since 2024-01-26
 */
@Service
@Transactional
@CacheConfig(cacheNames = "SysImgServiceImpl")
public class SysImgServiceImpl extends ServiceImpl<SysImgMapper, SysImg> implements SysImgService {

    @Cacheable(cacheNames = "sysimg",key = "#id")
    @Override
    public SysImg getById(Serializable id){
        return super.getById(id);
    }

    @CacheEvict(cacheNames = "sysimg", key = "#id")
    @Override
    public boolean removeById(Serializable id) {
        return super.removeById(id);
    }

    @CacheEvict(cacheNames = "sysimg", key = "#sysimg.id")
    @Override
    public boolean updateById(SysImg sysimg) {
        return super.updateById(sysimg);
    }

    @CachePut(cacheNames = "sysimg", key = "#sysimg.id")
    public SysImg saveSysImg(SysImg sysimg){
        super.save(sysimg);
        return sysimg;
    }

    @CacheEvict(cacheNames = "sysimg", key = "#sysimg.id")
    public SysImg updateSysImgById(SysImg sysimg){
        super.updateById(sysimg);
        return sysimg;
    }
}
